package org.gpf.simpleFactory.operaiton;
/**
 * 运算工厂类
 * 用于实例化运算的实例
 * JDK1.7新增加了switch-case对字符串的支持
 * @author gaopengfei
 * @date 2015-4-26 上午11:23:52
 */
public class OperationFactory {

	public static Operation getOperationInstance(String operation){
		
		Operation oper = null;
		switch (operation) {
		case "+":
			oper = new OperationAdd();
			break;
		case "-":
			oper = new OperationSub();
			break;
		case "*":
			oper = new OperationMul();
			break;
		case "/":
			oper = new OperationDiv();
		default:
			break;
		}
		return oper;
	}
}
